package com.hospital.yang.login.service.impl;

import com.hospital.yang.login.dao.DoctorLoginMapper;
import com.hospital.yang.login.entity.DoctorLogin;
import com.hospital.yang.login.service.DoctorLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @PackgeName: com.hospital.yang.login.service.impl
 * @ClassName: DoctorLoginServiceImpl
 * @Author: 比巴卜
 * Date: 2021/9/16 15:25
 * project name: hospital
 * @Version: 1.8
 * @Description:
 */
@Service
public class DoctorLoginServiceImpl implements DoctorLoginService {

    @Autowired
    private DoctorLoginMapper dao;

    /**
     * 医生登录
     *
     * @param docdorid 医生id
     * @param pwd      密码
     * @return
     */
    @Override
    public boolean login(String doctorid, String doctorpwd) {
        int login = dao.login(doctorid, doctorpwd);
        if (login == 1) {
            return true;
        }
        return false;
    }

    /**
     * 验证是否正确
     *
     * @param doctorId
     * @param doctorid
     * @param doctorcard
     * @return
     */
    @Override
    public boolean forgetPwd(String doctorid, String doctorcard) {
        int count = dao.forgetPwd(doctorid, doctorcard);
        if (count == 1) {
            return true;
        }
        return false;
    }

    @Override
    public void updatePwd(String doctorid, String doctorpwd) {
        dao.updatePwd(doctorid, doctorpwd);
    }

    @Override
    public DoctorLogin doctor(String id) {
        return dao.doctor(id);
    }

}
